{*

/**
 * PENGUIN FrameWork
 * @author hungtd <tdhungit@gmail.com> 0972014011
 * @copyright Tran Dinh Hung 2011
 * 
 * Admin Permission
 * 
 * @package PenguinFW
 * @subpackage User
 * @version 1.0.0
 */

*}

<div class="heading">
    <h1>{lang('Permission')} {lang('Role')}: {$user_role->name}</h1>
    
    <div class=buttons>        
        <a href="javascript:void(0)" onClick="$('#FormPermissionRole').submit();" class="button"><span>{lang('Permission')}</span></a>
    </div>
</div>
<div class="content">
    <form action="{base_url('users/admin_roles/permission')}" id="FormPermissionRole" method="post">
        <input type="hidden" name="role_id" value="{$user_role->id}" />
        <table class="list">            
            <thead>
                <tr>
                    <td class="left">{lang('Module')}</td>
                    <td class="left">                        
                        <table class="list">
                            <thead>
                                <tr>
                                    <td class="left" width="200px">{lang('Module resource')}</td>
                                    <td class="left" width="100px">Read</td>
                                    <td class="left" width="100px">Write</td>
                                    <td class="left" width="100px">Modify</td>
                                    <td class="left" width="100px">Publish</td>
                                    <td class="left">Delete</td>
                                </tr>
                            </thead>
                        </table>
                    </td>
                </tr>                                
            </thead>

            <tbody>                    
                {foreach $resource_permissions as $resource_permission}
                    <tr>
                        <td class="left">{$resource_permission.module}</td>
                        <td class="left">
                            <table class="list">
                                <tbody>
                                    {foreach $resource_permission.resources as $resource}
                                        <tr>
                                            <td class="left" width="200px">{$resource.name}</td>
                                            <td class="left" width="100px">                                                
                                                <div class="radio-button p-right"><input type="radio" value="0" name="read[{{$resource.id}}]" checked="checked" /> Off</div>
                                                <div class="radio-button"><input type="radio" value="1" name="read[{{$resource.id}}]" {if $current_resource_permissions[$resource.id].read eq 1}checked="checked"{/if} /> On</div>                                                
                                            </td>
                                            <td class="left" width="100px">
                                                <div class="radio-button p-right"><input type="radio" value="0" name="write[{{$resource.id}}]" checked="checked" /> Off</div>
                                                <div class="radio-button"><input type="radio" value="1" name="write[{{$resource.id}}]" {if $current_resource_permissions[$resource.id].write eq 1}checked="checked"{/if} /> On</div>                                                
                                            </td>
                                            <td class="left" width="100px">
                                                <div class="radio-button p-right"><input type="radio" value="0" name="modify[{{$resource.id}}]" checked="checked" /> Off</div>
                                                <div class="radio-button"><input type="radio" value="1" name="modify[{{$resource.id}}]" {if $current_resource_permissions[$resource.id].modify eq 1}checked="checked"{/if} /> On</div>                                                
                                            </td>
                                            <td class="left" width="100px">
                                                <div class="radio-button p-right"><input type="radio" value="0" name="publish[{{$resource.id}}]" checked="checked" /> Off</div>
                                                <div class="radio-button"><input type="radio" value="1" name="publish[{{$resource.id}}]" {if $current_resource_permissions[$resource.id].publish eq 1}checked="checked"{/if} /> On</div>                                                
                                            </td>
                                            <td class="left">
                                                <div class="radio-button p-right"><input type="radio" value="0" name="delete[{{$resource.id}}]" checked="checked" /> Off</div>
                                                <div class="radio-button"><input type="radio" value="1" name="delete[{{$resource.id}}]" {if $current_resource_permissions[$resource.id].delete eq 1}checked="checked"{/if} /> On</div>                                                
                                            </td>
                                        </tr>
                                    {/foreach}
                                </tbody>
                            </table>
                        </td>
                    </tr>
                {/foreach}
            </tbody>            
        </table>
    </form>    
</div>